package test.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import test.couchdb.ModelsDb;

@Controller
@RequestMapping("/item/{id}")
public class ItemController {
    @Autowired
    private ModelsDb modelsDb;

    @RequestMapping(method = RequestMethod.GET)
    public String get(@PathVariable String id, Model model) {
        model.addAttribute("model", modelsDb.get(id));

        return "/item";
    }
}
